﻿/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2010-7-5
 * Time: 22:47
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.IO;
using System.Text;
//using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;

using AjaxPro;

namespace ECCIT.Utilities
{
    using JavaScriptSerializer = System.Web.Script.Serialization.JavaScriptSerializer;
	/// <summary>
	/// Description of 
	/// </summary>
	[Serializable]
    [AjaxNamespace("JsonUtil")]
    public sealed class JsonUtil
	{
        [AjaxMethod()]
        public static string Serialize(object obj)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Serialize(obj);
        }

        [AjaxMethod()]
        public static T Deserialize<T>(string text)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Deserialize<T>(text);
        }

        [AjaxMethod ()]
        public static object DeserializeObject (string text)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer ();
            return serializer.DeserializeObject (text);
        }
	}
}
